<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        table {
            margin: 0 auto;
            width: 1000px;
            border-collapse: collapse;
        }

        caption {
            font-size: 32px;
            line-height: 64px;
            font-weight: bold;
        }

        tr,
        th,
        td {
            line-height: 32px;
            text-align: center;
            border: 1px solid black;
        }
    </style>
</head>

<body>
    <script>
        let totalBalance = prompt('请输入银行卡总额：')
        let waterCharge = prompt('请输入水费：')
        let electricCharge = prompt('请输入电费：')
        let networkCharge = prompt('请输入网费：')

        let balance = totalBalance - waterCharge - electricCharge - networkCharge

        document.write(
            `<table>
            <caption>2024年10月消费支出</caption>
            <tr>
                <th>银行卡余额</th>
                <th>水费</th>
                <th>电费</th>
                <th>网费</th>
                <th>银行卡余额</th>
            </tr>
            <tr>
                <td>${totalBalance}</td>
                <td>${waterCharge}</td>
                <td>${electricCharge}</td>
                <td>${networkCharge}</td>
                <td>${balance}</td>
            </tr>
            </table>`
        )
    </script>

</body>

</html>